//
//  StartupCommondBuilder.swift
//  HeadlineNews
//
//  Created by han on 2019/5/30.
//  Copyright © 2019 han. All rights reserved.
//

import UIKit

class CommondBuilder: NSObject {
    private var keyWindow: UIWindow!
    
    init(keyWindow: UIWindow) {
        super.init()
        self.keyWindow = keyWindow
    }
    
    func builders() -> [Command] {
        return [
            ConstantConfiguration(),
            InitializeRootWindow(keyWindow: keyWindow),
            ThirdPartConfiguration()
        ]
    }
}

protocol Command {
    func execute()
}


struct  ConstantConfiguration: Command{
    func execute() {
        // 设置本地语言
        HeadlineLanguages.initCurrentLanguage()
        //本地主题
        HeadlineTheme.initLocalTheme()
        // swizzling
        UIViewController.initializeMethod()
    
    }
}

struct InitializeRootWindow: Command {
    let keyWindow: UIWindow!
    func execute() {
        keyWindow.rootViewController = TabBarController()
        
    }
}

struct ThirdPartConfiguration: Command {
    func execute() {
       
    }
}
